package org.game.controller;

import com.sojoys.artifact.constant.ServerStatusEnum;
import com.sojoys.artifact.core.IServer;
import com.sojoys.artifact.plugin.netty.web.NettyWebPlugin;
import com.sojoys.artifact.third.web.core.NettyHttpContext;
import com.xiaoleilu.hutool.log.Log;
import com.xiaoleilu.hutool.log.LogFactory;
import org.game.manager.GameServerManager;

/**
 * 停止服务器
 *
 * @author win7
 */

public class SetServerState {
	
	static final Log log = LogFactory.get(SetServerState.class);
	/**
	 * 停止游戏服务器
	 * @param ctx
	 * @return
	 */
	public void setAegis(NettyHttpContext ctx) {
		IServer.SERVER_STATUS = ServerStatusEnum.AEGIS;
		GameServerManager.me().registerGameServerInfo();
		ctx.send("Succeed");
	}

	/**
	 * 开服
	 * @param ctx
	 * @return
	 */
	public void setRunning(NettyHttpContext ctx) {
		IServer.SERVER_STATUS = ServerStatusEnum.RUNNING;
		GameServerManager.me().registerGameServerInfo();
		ctx.send("Succeed");
	}
}